import http from '../util/request.js'

export default {
    //获取会员列表
    add:(obj)=>{
        return http({
            url:'/api/user',
            method:'POST',
            data:obj,
            headers: {
                //定义将数据以json的形式传入后台(java)
                'Content-Type': 'application/json'
            }
        });
    },
    edit:(obj)=>{
        return http({
            url:'/api/user',
            method:'PUT',
            data:obj,
            headers: {
                //定义将数据以json的形式传入后台(java)
                'Content-Type': 'application/json'
            }
        });
    },
    del:(id)=>{
        return http({
            url:'/api/user/'+id,
            method:'DELETE'
        });
    },
    page:(obj)=>{
        return http({
            url:'/api/user/page',
            method:'GET',
            //表单用param
            params:obj
        });
    },
    updatePassword:(passwordData)=>{
        return http({
            url:'/api/user/password',
            method:'put',
            data: passwordData,  // 使用data而不是params，并传递整个密码对象
            headers: {
                'Content-Type': 'application/json'
            }
        });
    },
    getByToken:()=>{
        return http({
            url:'/api/user/token',
            method:'GET',
        });
    },
    getUnknownCommit:(unknownData)=>{
        return http({
            url:'/api/user/unknown',
            method:'put',
            data: unknownData,  // 使用data而不是params，并传递整个密码对象
            headers: {
                'Content-Type': 'application/json'
            }
        });
    },
    unknownUpdatePassword:(passwordData)=>{
        return http({
            url:'/api/user/unknown/update',
            method:'put',
            data: passwordData,  // 使用data而不是params，并传递整个密码对象
            headers: {
                'Content-Type': 'application/json'
            }
        });
    },
 }












